package com.qzsoft.zhjd.laboratory.modules.marshallStabilityNew.controller;

import java.util.Arrays;
import java.util.Map;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qzsoft.jeemis.common.utils.Result;
import com.qzsoft.zhjd.common.utils.ResultUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.qzsoft.zhjd.laboratory.modules.marshallStabilityNew.entity.MarshallStabilityNewResEntity;
import com.qzsoft.zhjd.laboratory.modules.marshallStabilityNew.service.MarshallStabilityNewResService;

/**
 * 马歇尔稳定度测定仪_结果表
 *
 * @author sx
 * @email 
 * @date 2023-07-11 18:56:40
 */
@RestController
@RequestMapping("laboratory/marshallStabilityNewRes")
public class MarshallStabilityNewResController {

    @Autowired
    private MarshallStabilityNewResService marshallStabilityNewResService;

    /**
     * 列表
     */
    @RequestMapping("/page")
    @RequiresPermissions("laboratory:marshallStabilityNewRes:page")
    public Result page(@RequestParam Map<String, Object> params){
        IPage page = marshallStabilityNewResService.queryPage(params);
        return ResultUtils.ok(page);
    }


    /**
     * 信息
     */
    @RequestMapping("/find/{id}")
    @RequiresPermissions("laboratory:marshallStabilityNewRes:find")
    public Result find(@PathVariable("id") String id){
		MarshallStabilityNewResEntity marshallStabilityNewRes = marshallStabilityNewResService.getInfo(id);
        return ResultUtils.ok(marshallStabilityNewRes);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("laboratory:marshallStabilityNewRes:save")
    public Result save(@RequestBody MarshallStabilityNewResEntity marshallStabilityNewRes){
		marshallStabilityNewResService.saveData(marshallStabilityNewRes);
        return ResultUtils.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("laboratory:marshallStabilityNewRes:update")
    public Result update(@RequestBody MarshallStabilityNewResEntity marshallStabilityNewRes){
        marshallStabilityNewResService.updateData(marshallStabilityNewRes);
        return ResultUtils.ok();
    }


    /**
     * 删除单个
     */
    @RequestMapping("/delete/{id}")
    @RequiresPermissions("laboratory:marshallStabilityNewRes:delete")
    public Result deleteOne(@PathVariable("id") String id){
        marshallStabilityNewResService.deleteOneData(id);
        return ResultUtils.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("laboratory:marshallStabilityNewRes:delete")
    public Result delete(@RequestBody String[] ids){
        marshallStabilityNewResService.deleteData(Arrays.asList(ids));
        return ResultUtils.ok();
    }
}
